<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>瓜朋网Admin管理平台--文章管理</title>
<link rel="stylesheet" type="text/css" href="/hdocs/admin/css/theme.css" />
<link rel="stylesheet" type="text/css" href="/hdocs/admin/css/style.css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="/hdocs/admin/css/ie-sucks.css" />
<![endif]-->
<script type="text/javascript" src="/hdocs/jquery/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/hdocs/admin/js/common.js"></script>
<script type="text/javascript" src="/hdocs/admin/js/admin.js"></script>
</head>
<body onload="alertMsg('$!messageCodeMap.get($!messageCode)')">
	<div id="container">
		#set ($menuIndex="topic")
		#parse("/admin/inc/header.html")
		<div id="wrapper">
			<div id="content">
				<form action="/admin/topic/articleList.jsp" method="post">
					<table>
						<caption>文章管理</caption>
						<tr>
							<th>文章ID</th>
							<td>
								<input id="articleid" name="articleid" type="text" value="$!articleid"/>
							</td>
							<th>作者ID</th>
							<td>
								<input id="accountid" name="accountid" type="text" value="$!accountid"/>
							</td>
							<th>状态</th>
							<td>
								<select id="status" name="status">
									<option value="">---全部---</option>
									<option value="1" #if($!status == 1) selected #end>已发布</option>
									<option value="0" #if($!status == 0) selected #end>待发布</option>
									<option value="-1" #if($!status == -1) selected #end>已删除</option>
								</select>
							</td>
							<th>推荐类型</th>
							<td>
								<select id="indexType" name="indexType">
									<option value="">---全部---</option>
									<option value="1" #if($!indexType == 1) selected #end>flash</option>
									<option value="2" #if($!indexType == 2) selected #end>左边</option>
									<option value="3" #if($!indexType == 3) selected #end>右边</option>
									<option value="-1" #if($!indexType == -1) selected #end>不推荐</option>
								</select>
							</td>
							<td>
								<input type="submit" class="bt" value="查询"/>
							</td>
						</tr>
					</table>
				</form>
				<table>
					<thead>
						<tr>
							<th width="5%">文章ID</th>
							<th width="45%">文章</th>
							<th width="10%">状态</th>
							<th width="10%">推荐类型</th>
							<th width="20%">推荐到首页</th>
							<th width="10%">操作</th>
						</tr>
					</thead>
					#foreach( $article in $articleList)
					<tr>
						<td>$!article.id</td>
						<td>
							标题：<a href="/topic/article.jsp?id=$!article.id" target="_blank">$!article.title</a><br/>
							作者名称：$!article.username&nbsp;&nbsp;作者ID：$!article.accountid<br/>
							主题：$!article.subjectTitle<br/><br/>
						</td>
						<td>
							#if($!article.status == 0)
								待发布
							#elseif($!article.status == 1)
								已发布
							#elseif($!article.status == -1)
								已删除
							#else
								未知
							#end
						</td>
						<td>
							#if($!article.indexType == 1)
								flash
							#elseif($!article.indexType == 2)
								左边
							#elseif($!article.indexType == 3)
								右边
							#elseif($!article.indexType == 0)
								不推荐
							#else
								未推荐
							#end
						</td>
						<td>
							<a href="javascript:toUpdateIndexType($!article.id,1);">flash</a>&nbsp;&nbsp;
							<a href="javascript:toUpdateIndexType($!article.id,2);">左边</a>&nbsp;&nbsp;
							<a href="javascript:toUpdateIndexType($!article.id,3);">右边</a>&nbsp;&nbsp;
							<a href="javascript:toUpdateIndexType($!article.id,-1);">不推荐</a>
						</td>
						<td>
							<a href="javascript:toUpdateStatus($!article.id,1);">发布</a><br/><br/>
							<a href="javascript:toUpdateStatus($!article.id,0);">取消删除</a><br/><br/>
							<a href="javascript:toUpdateStatus($!article.id,-1);">删除</a>
						</td>
					</tr>
					#end
				</table>
				<form id="pageForm" action="/admin/topic/articleList.jsp" method="post" style="float:right;">
					<input name="accountid" type="hidden" value="$!accountid"/>
					<input id="updateArticleid" name="articleid" type="hidden" value="$!articleid"/>
					<input id="updateStatus" name="status" type="hidden" value="$!status"/>
					<input id="updateIndexType" name="indexType" type="hidden" value="$!indexType"/>
					#parse("/admin/inc/pageControl.html")
				</form>
			</div>
			#parse("/admin/inc/sidebar.html")
		</div>
		#parse("/admin/inc/footer.html")
	</div>
</body>
</html>
<script type="text/javascript">
function toUpdateIndexType(articleid,indexType){
	$("#updateArticleid").val(articleid);
	$("#updateIndexType").val(indexType);
	$("#pageForm").attr("action","/admin/topic/recommendArticle.jsp");
	$("#pageForm").submit();
}
function toUpdateStatus(articleid,status){
	$("#updateArticleid").val(articleid);
	$("#updateStatus").val(status);
	$("#pageForm").attr("action","/admin/topic/updateArticleStatus.jsp");
	$("#pageForm").submit();
}
</script>

